home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 358 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  3.5 KB

  1. Path: engnews1.Eng.Sun.COM!taumet!clamage
  2. From: "Eugene Radchenko" <eugene@qsar.chem.msu.su>
  3. Newsgroups: comp.std.c++
  4. Subject: Re: Observations on templates
  5. Date: 8 Feb 1996 17:00:57 GMT
  6. Organization: Lab. of Org.Synth., MSU
  7. Approved: clamage@eng.sun.com (comp.std.c++)
  8. Message-ID: <ADqNY6n4sN@qsar.chem.msu.su>
  9. References: <u9vilu8zvz.fsf@yorick.cygnus.com>
  10. NNTP-Posting-Host: taumet.eng.sun.com
  11. Content-Type: text
  12. X-Mailer: dMail [Demos Mail for DOS v1.23]
  13. Content-Length: 2838
  14. X-Lines: 55
  15. Originator: clamage@taumet
  16.  
  17. jason@cygnus.com (Jason Merrill) writes
  18. >>>>>> Eugene Radchenko <eugene@qsar.chem.msu.su> writes:
  19. >
  20. >> 1) Clause [temp.res] verse 1 requires that all types dependent on the
  21. >> template parameter must be qualified by 'typename' keyword - supposedly to
  22. >> allow checking the template syntax. But it does not help anything as _each_
  23. >> instance will have to be checked anyway:
  24. >
  25. >Requiring 'typename' allows syntactic analysis and some name binding
  26. >to be done at the point of definition of the template.  Older
  27. >implementations do all name binding at the point of instantiation,
  28. >which was thought to be confusing.
  29. >
  30. >Each instance will indeed have to be checked, but only for semantic
  31. >correctness, not syntactic.
  32. And does such a simplification (which does not simplify anything as
  33. complete recheck is still needed) warrant the introduction of a new keyword
  34. (why could not at least the 'class' keyword be used like in template
  35. prefix?). Interestingly, WRT member functions (and especially operator->)
  36. the decision was roughly inverse (i.e. to perform checking only on the
  37. per-instance basis and only if given instance is required).
  38.  
  39. >> 2) Clause [temp.dep] verse 5 states that base class scope names hide the
  40. >> template parameter:
  41. >
  42. >This is for orthogonality.  Think of the template header as creating a
  43. >special scope around the class; name lookups in class scope look in the
  44. >current class, then in base classes, then in the surrounding scope.
  45. That much I do understand. I only think that such an order is
  46. counter-intuitive. The template parameters is something related to this
  47. particular class and hence must be in the scope that is inner WRT its base
  48. classes. Also, we have qualified names to access base class members while
  49. current specs make template parameters completely inaccessible.
  50.  
  51. >> 3) Clause [temp.arg.explicit] verses 2-3 requires that for explicit arg in
  52. >> member template to be present it must be qualified by 'template' keyword,
  53. >> e.g.
  54. >>      X *p; p->template alloc<200>();
  55. >> But to use operator -> we need X class definition anyway - so we know that
  56. >> alloc() is a template.
  57. >
  58. >It is needed in some situations where we do not have the X class definition
  59. >-- in template definitions, like with typename.
  60. And what are we supposed to do with function alloc() if we do not have the
  61. class definition and hence do not know anything about this function?
  62.  
  63.              Cheers                   Genie
  64. --
  65. --------------------------------------------------------------------
  66. Eugene V. Radchenko           Research associate, Computer Chemistry
  67. E-mail: eugene@qsar.chem.msu.su                Fax: +7-(095)939-0290 
  68. Ordinary mail:  Chair of Organic Chemistry, Department of Chemistry,
  69.                       Moscow State University, 119899 Moscow, Russia
  70. *****************  Disappearances are deceptive  *******************
  71.  
  72.  
  73. [ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  74.   Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy is
  75.   summarized in http://reality.sgi.com/employees/austern_mti/std-c++/policy.html
  76. ]
  77.